import { EDITOR_ELEMENT_TYPE, PLUGINS_KEYS, Plugin } from '../types';
import styles from './styles.module.less';

function InLineCode(): Plugin {
  return {
    key: PLUGINS_KEYS.INLINECODE,
    type: EDITOR_ELEMENT_TYPE.INLINE,
    matchLeaf: (props) => !!props.leaf[PLUGINS_KEYS.INLINECODE],
    renderLeaf: (context) => {
      context.classList.push(styles['inline-code']);
      return context.children;
    },
  };
}

export default InLineCode;
